<!DOCTYPE html>
<html class="x-admin-sm">

	{include file="public/_header" /}
	<link rel="stylesheet" href="__STATIC__/admin/css/ztree.css" type="text/css">
	<script src="__STATIC__/admin/js/jquery.ztree.core.min.js" charset="utf-8"></script>
	<body class="index">
		<div class="x-nav">
			<span class="layui-breadcrumb">
				<a href="">首页</a>
				<a>
					<cite>文章管理</cite></a>
			</span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()"
			 title="刷新">
				<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
			</a>
		</div>
		<div class="layui-fluid-ztree">
			<div class="ztree-btn"></div>
			<div class="ztree-table">
				<ul id="treeDemo" class="ztree"></ul>
			</div>

		</div>
		<div class="layui-fluid-coontent">
			<iframe src="{:url('admin/index/welcome')}" id="iframe-list" frameborder="0" scrolling="yes" class="x-iframe"></iframe>
		</div>

		<script type="text/html" id="toolbarDemo">
			<div class="layui-btn-container">
				<button class="layui-btn layui-btn-sm" lay-event="getCheckData">
					 <i class="layui-icon">&#xe608;</i> 添加
				</button>
				<button class="layui-btn layui-btn-sm layui-btn-warm" lay-event="getCheckLength">
					<i class="layui-icon">&#xe642;</i>移动
				</button>
				<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="isAll">
					<i class="layui-icon">&#xe640;</i>回收站
				</button>
			</div>
	</script>

		<script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
	  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>

		<script>
			function onClick(event, treeId, treeNode, clickFlag) {
				document.getElementById("iframe-list").src = "{:url('admin/Article/lists')}?id=" + treeNode.id + "&model_id=" +
					treeNode.model_id;
			}
			$(function() {

				var setting = {
					data: {
						simpleData: {
							enable: true
						}
					},
					callback: {
						onClick: onClick
					}
				};
				$.ajax({
					type: "get",
					url: "{:url('admin/article/cate')}",
					data: {},
					dataType: "json",
					success: function(res) {
						$.fn.zTree.init($("#treeDemo"), setting, res.data);
					},
				});
			})
		</script>
	</body>
</html>
